#include <stdio.h>

#define INTEGER     0
#define NUMBERATOR  1
#define DENOMINATOR 2

long findMaxSubmultiple(long a, long b)
{
	long temp;

	if(a < 0) a = -a;
	if(b < 0) b = -b;
	do {
		temp = a % b;
		a = b;
		b = temp;
	} while(temp);

	return a;
}

void calc(long *a, long *b, long *res, char op)
{
	long temp = b[NUMBERATOR];

	switch(op)
	{
		case '-':
			temp = -b[NUMBERATOR];
		case '+':
		{
			res[DENOMINATOR] = (a[DENOMINATOR] * b[DENOMINATOR] ) / 
				findMaxSubmultiple(a[DENOMINATOR], b[DENOMINATOR]);
			res[NUMBERATOR] = 
				a[NUMBERATOR] * (res[DENOMINATOR] / a[DENOMINATOR]) +
				temp * (res[DENOMINATOR] / b[DENOMINATOR]);
			break;
		}
		case '*':
		{
			res[NUMBERATOR] = a[NUMBERATOR] * b[NUMBERATOR];
			res[DENOMINATOR] = a[DENOMINATOR] * b[DENOMINATOR];
			break;
		}
		case '/':
		{
			if(0 == b[NUMBERATOR])
				res[DENOMINATOR] = 1;
			else
			{
				res[NUMBERATOR] = a[NUMBERATOR] * b[DENOMINATOR];
				res[DENOMINATOR] = a[DENOMINATOR] * b[NUMBERATOR];
			}
			break;
		}
	}
}

void simplify(long *num)
{
	long maxSubmultiple;

	if(0 == num[DENOMINATOR])
		return;
	
	num[INTEGER] += (num[NUMBERATOR] / num[DENOMINATOR]);
	num[NUMBERATOR] = num[NUMBERATOR] % num[DENOMINATOR];
	
	if(0 != num[NUMBERATOR])
	{
		maxSubmultiple = findMaxSubmultiple(num[NUMBERATOR], num[DENOMINATOR]);
		num[NUMBERATOR]  /= maxSubmultiple;
		num[DENOMINATOR] /= maxSubmultiple;
	}

	if(num[DENOMINATOR] < 0)
	{
		num[DENOMINATOR] = -num[DENOMINATOR];
		num[NUMBERATOR] = -num[NUMBERATOR];
	}

	if(num[INTEGER] < 0 && num[NUMBERATOR] < 0)
	{
		num[NUMBERATOR] = -num[NUMBERATOR];
	}
}

void printRes(long *num)
{
	if(num[INTEGER] > 0)
	{
		if(num[NUMBERATOR] != 0)
			printf("%ld %ld/%ld", num[INTEGER], num[NUMBERATOR], num[DENOMINATOR]);
		else
			printf("%ld", num[INTEGER]);
	}
	else if(num[INTEGER] == 0)
	{
		if(num[NUMBERATOR] > 0)
			printf("%ld/%ld", num[NUMBERATOR], num[DENOMINATOR]);
		else if(num[NUMBERATOR] < 0)
			printf("(%ld/%ld)", num[NUMBERATOR], num[DENOMINATOR]);
		else
			printf("%ld", num[INTEGER]);
	}
	else
	{
		if(num[NUMBERATOR] != 0)
			printf("(%ld %ld/%ld)", num[INTEGER], num[NUMBERATOR], num[DENOMINATOR]);
		else
			printf("(%ld)", num[INTEGER]);
	}
}

void show(long *a, long *b, long *res, char op)
{
	printRes(a);
	switch(op)
	{
		case '+': printf(" + "); break;
		case '-': printf(" - "); break;
		case '*': printf(" * "); break;
		case '/': printf(" / "); break;
	}
	printRes(b);
	printf(" = ");

	if(0 == b[INTEGER] && 0 == b[NUMBERATOR] && '/' == op)
		printf("Inf");
	else
		printRes(res);
	printf("\n");
}

int main(int argc, char **argv)
{
	long  input1[3] = {0};
	long  input2[3] = {0};
	long  res[4][3] = {0};
	int   i = 0;
	char  op[4] = {'+', '-', '*', '/'};

	scanf("%ld/%ld", &input1[NUMBERATOR], &input1[DENOMINATOR]);
	scanf("%ld/%ld", &input2[NUMBERATOR], &input2[DENOMINATOR]);

	for(i = 0; i < 4; i++)
		calc(input1, input2, res[i], op[i]);

	simplify(input1);
	simplify(input2);

	for(i = 0; i < 4; i++)
	{
		simplify(res[i]);
		show(input1, input2, res[i], op[i]);
	}
	
 	return 0;
}